package server;

import java.io.Serializable;
import java.util.LinkedList;

import common.Tweet;

public class TweetStack implements Serializable{

	private LinkedList<Tweet> stack;
	
	public synchronized LinkedList<Tweet> getStack() {
		return stack;
	}

	public synchronized void setStack(LinkedList<Tweet> stack) {
		this.stack = stack;
	}

	public TweetStack() {
		this.stack = new LinkedList<Tweet>();
	}
	
	public TweetStack(TweetStack s) {
		this.stack = new LinkedList<Tweet>(s.getStack());
	}

	public synchronized Tweet pop() {
		return this.stack.pop();
	}

	public synchronized void push(Tweet t) {
		this.stack.add(t);
		notify();
	}

	public synchronized boolean isEmpty() {
		return this.stack.isEmpty();
	}
	
	public synchronized Tweet get(int i) {
		return this.stack.get(i);
	}

}
